﻿using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class PhotoItem : MonoBehaviour
{
    public NetworkImage img;

    public void Init(string tex)
    {
        this.img.Init(tex);
        //var size = img.GetComponent<RectTransform>().sizeDelta;
        //float rate = size.y / spr.textureRect.height;
        //rate = Mathf.Max(1, rate);
        //float y = spr.textureRect.height * rate;
        //float x = y * (spr.textureRect.width / spr.textureRect.height);
        //img.GetComponent<RectTransform>().sizeDelta = new Vector2(x, y);
    }

    // Start is called before the first frame update
    void Start()
    {
        
    }

    // Update is called once per frame
    void Update()
    {

    }
   

    //public void ClearTex()
    //{
    //    if (img.sprite != null)
    //        NewTextureController.instance.OnDestroySpr(img.sprite);

    //    //if (img.sprite != null)
    //    //    DestroyImmediate(img.sprite);

    //    img.sprite = null;
    //}
}
